//priority 10000
const itemStackHelper = {
    getItemAttackDamage(itemStack) {
        var amount = 0
        if (itemStack instanceof $ItemStack) {
            for (const iterator of itemStack.getAttributeModifiers("mainhand").entries()) {
                var AttributeModifier = iterator.getValue()
                if (AttributeModifier.getId().compareTo(Item.KJS_BASE_ATTACK_DAMAGE_UUID) == 0) {
                    amount = AttributeModifier.getAmount()
                    itemStack.allEnchantments.forEach((enchantment, lvl) => {
                        amount += enchantment.getDamageBonus(lvl, $MobType.UNDEFINED, itemStack)
                    });
                }
            }
            return amount
        }
    }
}

function ItemStackBuilder(itemStack) {
    this.itemStack = Item.of(itemStack)
    return this
}
/**
 * @callback nbtBuilder
 * @param {Internal.CompoundTag} nbt
 * @return {void}
*/
ItemStackBuilder.prototype.setNBT = function (/**@type nbtBuilder*/nbtBuilder) {
    nbtBuilder(this.itemStack.nbt)
    return this
}